package de.sendorian.app.forumArchive.repository;

import javax.persistence.NoResultException;

import org.springframework.stereotype.Component;

import de.sendorian.app.forumArchive.domain.Topic;


@Component("topicRepository")
public class TopicRepositoryImpl extends RepositoryBase<Topic> implements TopicRepository {

    public TopicRepositoryImpl() {
        super(Topic.class);
    }


    /* (non-Javadoc)
     * @see de.sendorian.app.forumArchive.repository.ITopicRepository#findByName(java.lang.String)
     */
    public Topic findByName(String name) {
        try {
            return findByUniqueAttribute("name", name);
        } catch (NoResultException e) {
            logger.debug("No Topic found with name " + name);
        }
        return null;
    }

}
